#ifndef _ITEMPARTICLE_DOT_H
#define _ITEMPARTICLE_DOT_H
#pragma once
#include "Particle.h"

#define ITEM_PARTICLE_DEATH_DURATION (0.15f)

/** Represents a resource that may be picked up in the world. **/
class ItemParticle :
    public Particle
{
private:
    float theta,        /**< Keeps track of "bouncing" effect and rotation **/
          scale,        /**< Scale of the particle in the range of 1.0f-0.0f
                             for shrinking effect **/
          timeKilled,   /**< Contains time that the particle was picked up
                             (or "killed"). Zero if not picked up. **/
          dumbTime;     /**< Time the particle should be "dumb", meaning that
                             it cannot be picked up for a certain length of time. **/

    bool  killed;       /**< True if particle has been picked up but has not died **/

    ofPoint locOffset,          /**< Holds current lerping offset **/
            locOffsetTarget;    /**< Holds current lerping target **/

protected:
    const int ID; /**< Contains the ID of the item the particle represents **/

public:
    /** Constructor.
        \param loc      Initial location of the particle
        \param vel      Initial velocity of the particle
        \param ID       Item ID represented by the particle
        \param ttl      Time-to-live for the particle
        \param dumbTime Time until the particle can be picked up **/
    ItemParticle(ofPoint loc, ofPoint vel, int ID, float ttl=1.0f, float dumbTime=0.1f);
    /** Destructor. **/
    ~ItemParticle(void);

    /** Retrieves the Item ID represented by the particle
        \return ID represented by the particle as an integer **/
    int getID();
    /** Determines if the particle has been killed (picked up) or not.
        \return true if particle has been picked up but has not died **/
    bool hasBeenKilled();

    /** Updates particle and performs all math and computationally intensive tasks.
        \return true if particle has died **/
    bool update();
    /** Draws the particle in the world. **/
    void draw();
    /** Notifies the particle that it is being picked up.
        \param xOffset X-Offset the particle should lerp toward while shrinking away
        \param yOffset Y-Offset the particle should lerp toward while shrinking away
        \return true if particle was successfully killed **/
    bool kill(float xOffset = 0.0f, float yOffset = 0.0f);
};
#endif